package application.openGL;

import org.lwjgl.opengl.GL11;

public class GLGraphics3D 
{
    public void setColor(int color)
    {
	this.setColor((color>>16)&0x0000FF, (color>>8)&0x0000FF, color&0x0000FF);
    }
    public void setColor(int r, int g, int b)
    {
	this.setColor(r/255.0f, g/255.0f, b/255.0f);
    }
    public void setColor(float r, float g, float b)
    {
	GL11.glColor3f(r, g, b);
    }
    public void setColor(int r, int g, int b, int a)
    {
	this.setColor(r/255.0f, g/255.0f, b/255.0f, a/255.0f);
    }
    public void setColor(float r, float g, float b, float a)
    {
	GL11.glColor4f(r, g, b, a);
    }
    public void drawRectangularPrism(int x, int y, int z, int w, int h, int d, int the)
    {
	GL11.glLoadIdentity();
	GL11.glTranslatef(x, y, z);
	GL11.glRotatef(the, 1.0f, 0.5f, 0.25f);
	GL11.glBegin(GL11.GL_QUADS);
	GL11.glColor3f(0.0f, 1.0f, 0.0f); // Set The Color To Green
	GL11.glVertex3f(1.0f, 1.0f, -1.0f); // Top Right Of The Quad (Top)
	GL11.glVertex3f(-1.0f, 1.0f, -1.0f); // Top Left Of The Quad (Top)
	GL11.glVertex3f(-1.0f, 1.0f, 1.0f); // Bottom Left Of The Quad (Top)
	GL11.glVertex3f(1.0f, 1.0f, 1.0f); // Bottom Right Of The Quad (Top)

	GL11.glColor3f(1.0f, 0.5f, 0.0f); // Set The Color To Orange
	GL11.glVertex3f(1.0f, -1.0f, 1.0f); // Top Right Of The Quad (Bottom)
	GL11.glVertex3f(-1.0f, -1.0f, 1.0f); // Top Left Of The Quad (Bottom)
	GL11.glVertex3f(-1.0f, -1.0f, -1.0f); // Bottom Left Of The Quad (Bottom)
	GL11.glVertex3f(1.0f, -1.0f, -1.0f); // Bottom Right Of The Quad (Bottom)

	GL11.glColor3f(1.0f, 0.0f, 0.0f); // Set The Color To Red
	GL11.glVertex3f(1.0f, 1.0f, 1.0f); // Top Right Of The Quad (Front)
	GL11.glVertex3f(-1.0f, 1.0f, 1.0f); // Top Left Of The Quad (Front)
	GL11.glVertex3f(-1.0f, -1.0f, 1.0f); // Bottom Left Of The Quad (Front)
	GL11.glVertex3f(1.0f, -1.0f, 1.0f); // Bottom Right Of The Quad (Front)

	GL11.glColor3f(1.0f, 1.0f, 0.0f); // Set The Color To Yellow
	GL11.glVertex3f(1.0f, -1.0f, -1.0f); // Bottom Left Of The Quad (Back)
	GL11.glVertex3f(-1.0f, -1.0f, -1.0f); // Bottom Right Of The Quad (Back)
	GL11.glVertex3f(-1.0f, 1.0f, -1.0f); // Top Right Of The Quad (Back)
	GL11.glVertex3f(1.0f, 1.0f, -1.0f); // Top Left Of The Quad (Back)

	GL11.glColor3f(0.0f, 0.0f, 1.0f); // Set The Color To Blue
	GL11.glVertex3f(-1.0f, 1.0f, 1.0f); // Top Right Of The Quad (Left)
	GL11.glVertex3f(-1.0f, 1.0f, -1.0f); // Top Left Of The Quad (Left)
	GL11.glVertex3f(-1.0f, -1.0f, -1.0f); // Bottom Left Of The Quad (Left)
	GL11.glVertex3f(-1.0f, -1.0f, 1.0f); // Bottom Right Of The Quad (Left)

	GL11.glColor3f(1.0f, 0.0f, 1.0f); // Set The Color To Violet
	GL11.glVertex3f(1.0f, 1.0f, -1.0f); // Top Right Of The Quad (Right)
	GL11.glVertex3f(1.0f, 1.0f, 1.0f); // Top Left Of The Quad (Right)
	GL11.glVertex3f(1.0f, -1.0f, 1.0f); // Bottom Left Of The Quad (Right)
	GL11.glVertex3f(1.0f, -1.0f, -1.0f); // Bottom Right Of The Quad (Right)
	GL11.glEnd(); // Done Drawing The Quad
    }
}
